<!--
  ~ MIT License
  ~
  ~ Copyright (c) 2019-2023 JetBrains s.r.o.
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->
<!DOCTYPE HTML>
<html>
<head>
  <title>Please wait...</title>
  <meta charset="UTF-8">
  <meta content="JetBrains Projector" name="apple-mobile-web-app-title"/>
  <meta content="yes" name="apple-mobile-web-app-capable"/>
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
  <link href="pj.svg" rel="shortcut icon" type="image/x-icon">
  <link href="styles.css" rel="stylesheet" type="text/css">
  <link href="manifest.webmanifest" rel="manifest">
  <link href="apple-touch-icon.png" rel="apple-touch-icon" sizes="192x192" >

  <script src="https://cdn.jsdelivr.net/pako/1.0.3/pako.min.js"></script>
  <script>
    // Disable caching for some scripts (described here: https://stackoverflow.com/questions/118884/how-to-force-the-browser-to-reload-cached-css-js-files):
    const timestamp = Math.floor(Date.now());
    const notCachableScripts = [
      "projector-client-web.js",
    ];

    notCachableScripts.forEach((script) => document.write(
        '<script src="' +
        script +
        '?v=' +
        timestamp +
        '" type="text/javascript"><\/script>'
    ));

    function onLoad() {
      if (window['projector-client-web']) {
        window['projector-client-web'].org.jetbrains.projector.client.web.onLoad();
      }
      else {
        alert("Can't find window['projector-client-web']... Maybe the deployment is broken and there is no JS.");
      }
    }

    if ('serviceWorker' in navigator) {
      navigator.serviceWorker
          .register('/projector-client/serviceworker.js')
          .then(
              function () {
                console.log('Service Worker registered');
              },
              function (e) {
                console.log('Service Worker registration failed', e);
              },
          );
    }
  </script>
</head>

<body onload="onLoad()">
</body>
</html>
